//
//  SHObtainViewController.m
//  UI_CarHome
//
//  Created by dllo on 15/11/2.
//  Copyright (c) 2015年 沈浩. All rights reserved.
//

#import "SHObtainViewController.h"
#import "SHDiscountModel.h"
#import "SHHandle.h"
@interface SHObtainViewController ()
@property(nonatomic, retain)UIScrollView *mainScrollView;
@property(nonatomic, retain)UIImageView *leftImageView;
@property(nonatomic, retain)UILabel *topLabel;
@property(nonatomic, retain)UILabel *intentionLabel;// 意向
@property(nonatomic, retain)UILabel *modelNameLabel;
@property(nonatomic, retain)UILabel *addressLabel;
@property(nonatomic, retain)UITextField *nameTextField;
@property(nonatomic, retain)UITextField *phoneTextField;
@property(nonatomic, retain)UIButton *discountButton;

@end

@implementation SHObtainViewController
- (void)dealloc
{
    [_mainScrollView release];
    [_leftImageView release];
    [_topLabel release];
    [_intentionLabel release];
    [_modelNameLabel release];
    [_addressLabel release];
    [_nameTextField release];
    [_phoneTextField release];
    [_discountButton release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = BACKGROUNDCOLOR;
    self.mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    [self.view addSubview:self.mainScrollView];
    [_mainScrollView release];
    self.mainScrollView.backgroundColor = BACKGROUNDCOLOR;
    self.topLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 20)];
    [self.mainScrollView addSubview:self.topLabel];
    [_topLabel release];
    self.topLabel.text = @"填写如下信息获取跟多优惠,我们会对您的信息保密.";
    self.topLabel.font = [UIFont systemFontOfSize:12];
    self.topLabel.textColor = [UIColor grayColor];
    self.topLabel.textAlignment = NSTextAlignmentCenter;
  
    
    self.leftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 30, 150, 100)];
    [self.mainScrollView addSubview:self.leftImageView];
    [_leftImageView release];
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:self.discountModel.image]];
    
    self.intentionLabel = [[UILabel alloc] initWithFrame:CGRectMake(160, 30, 90, 20)];
    [self.mainScrollView addSubview:self.intentionLabel];
    [_intentionLabel release];
    self.intentionLabel.text = @"意向车型";
    self.intentionLabel.textAlignment = NSTextAlignmentLeft;
    self.intentionLabel.textColor = [UIColor grayColor];
    self.intentionLabel.font = [UIFont systemFontOfSize:14];
    
    self.modelNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(160, 50, 200, 80)];
    [self.mainScrollView addSubview:self.modelNameLabel];
    [_modelNameLabel release];
    self.modelNameLabel.text = self.discountModel.modelName;
    self.modelNameLabel.numberOfLines = 2;
    [self.modelNameLabel sizeToFit];
    self.modelNameLabel.textColor = TEXTCOLOR;
    
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 140,  300, 50)];
    [self.mainScrollView addSubview:self.addressLabel];
    [_addressLabel release];
    self.addressLabel.text = self.discountModel.area;
    self.addressLabel.textColor = [UIColor grayColor];
    
    UIView *firstView = [[UIView alloc] initWithFrame:CGRectMake(0, 190, WIDTH, 1)];
    [self.mainScrollView addSubview:firstView];
    [firstView release];
    firstView.backgroundColor = [UIColor lightGrayColor];
    
    self.nameTextField = [[UITextField alloc] initWithFrame:CGRectMake(15, 191, 300, 50)];
    [self.mainScrollView addSubview:self.nameTextField];
    [_nameTextField release];
    self.nameTextField.placeholder = @"请输入您的姓名";
    self.nameTextField.textAlignment = NSTextAlignmentLeft;
    self.nameTextField.textColor = [SHSingleton shareSingletion].isNight ? [UIColor whiteColor] : [UIColor grayColor];

    
    UIView *secondView = [[UIView alloc] initWithFrame:CGRectMake(0, 242, WIDTH, 1)];
    [self.mainScrollView addSubview:secondView];
    [secondView release];
    secondView.backgroundColor = [UIColor lightGrayColor];
    
    self.phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(15, 244, 300, 50)];
    [self.mainScrollView addSubview:self.phoneTextField];
    [_phoneTextField release];
    self.phoneTextField.placeholder = @"请输入您的手机号码";
    self.phoneTextField.textAlignment = NSTextAlignmentLeft;
    
    self.discountButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.discountButton.frame = CGRectMake(15, 300, 300, 50);
    self.discountButton.backgroundColor = NEWBLUE;
    [self.mainScrollView addSubview:self.discountButton];
    [self.discountButton setTitle:@"获取优惠" forState:UIControlStateNormal];
    [self.discountButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)click:(UIButton *)button {
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
